import React from 'react';
import cn from 'classnames';
import {
	Warning32 as Warning,
	Information32 as Info,
	CheckmarkOutline32 as Success,
} from '@carbon/icons-react';
import { confirm } from '@kuiper-components/dialog';
import s from './confirm.module.css';

const icon = {
	warning: Warning,
	info: Info,
	success: Success,
};
export default new Proxy(
	{},
	{
		get(obj, type) {
			const Icon = icon[type];
			return ({ message, ...options }) =>
				confirm({
					closable: true,
					maskClosable: true,
					title: '提示',
					message: (
						<div className={cn(s.content, s[type])}>
							{Icon && <Icon className={s.icon} />}
							<div className={s.message}>{message}</div>
						</div>
					),
					okText: '确定',
					cancelText: '取消',
					onOk: () => {},
					...options,
				});
		},
	}
);
